//
//  NSObject+EXtension.swift
//  weibo
//
//  Created by Fly on 2017/12/20.
//  Copyright © 2017年 Fly. All rights reserved.
//

import Foundation

extension NSObject {

    /// 生成[from,to]范围随机数
    ///
    /// - Parameters:
    ///   - fromNum: 下限
    ///   - toNum: 上线
    /// - Returns: 随机数
    open class func getRandomNum(fromNum: Int, toNum: Int) -> Int {
        
        let x = UInt32(toNum - fromNum + 1)
        
        let y = arc4random_uniform(x)
        
        let i: Int = fromNum + Int(y);
        
        return i;
    }

}
